package org.computate.form;

import org.computate.model.dao.Daos;
import org.computate.model.item.Review;

public class ReviewForm extends ComputateForm {
	
	public String getDisplayName() { return "Patient Review"; }
	
	private int rating;
	private String firstName;
	private String lastName;
	private boolean namePermission;
	private String email;
	private String description;
	private String title;
	
	public ReviewForm() {
		super("Patient Review");
		addField("title", "Reason for Visit:");
		addField("rating", "Rating:").setStars(5);
		addField("doctor", "Doctor:").setDropdown(true);
		addField("description", "Description:").setTextarea(true);
		addField("firstName", "First Name:");
		addField("lastName", "Last Name:");
		addField("namePermission", "I give my permission to use my first name and last initial on the website:");
		addField("email", "Email (will not be shown on the website):");
	}
	
	@Override
	public void submit(Daos daos) {
		Review result = daos.getReviewDao().create();
		
		result.setFirstName(firstName);
		result.setLastName(lastName);
		result.setRating(rating);
		result.setNamePermission(namePermission);
		result.setEmail(email);
		result.setDescription(description);
		result.setApproved(false);
		result.setTitle(title);
		
		daos.getReviewDao().put(result);
	}

	public int getRating() {
		return rating;
	}

	public void setRating(int rating) {
		this.rating = rating;
	}

	public String getFirstName() {
		return firstName;
	}

	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}

	public String getLastName() {
		return lastName;
	}

	public void setLastName(String lastName) {
		this.lastName = lastName;
	}

	public boolean isNamePermission() {
		return namePermission;
	}

	public void setNamePermission(boolean namePermission) {
		this.namePermission = namePermission;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}
}
